package com.efast.dmom.mgmt.service.les.impl;

import com.efast.dmom.mgmt.bean.les.DpathWindowTimeBean;
import com.efast.dmom.mgmt.bean.les.InventoryQuantityBean;
import com.efast.dmom.mgmt.bean.les.TwInvPalMriJobBean;
import com.efast.dmom.mgmt.bean.les.WindowReplenishmentBean;
import com.efast.dmom.mgmt.dao.les.TwBasDpathWindowTimeDao;
import com.efast.dmom.mgmt.entity.les.TwBasDpathWindowTime;
import com.efast.dmom.mgmt.service.les.TwBasDpathWindowTimeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Administrator
 *
 */
@Service
public class TwBasDpathWindowTimeServiceImpl implements TwBasDpathWindowTimeService {

	private final TwBasDpathWindowTimeDao twBasDpathWindowTimeDao;

	@Autowired
	public TwBasDpathWindowTimeServiceImpl(TwBasDpathWindowTimeDao twBasDpathWindowTimeDao) {
		this.twBasDpathWindowTimeDao = twBasDpathWindowTimeDao;
	}

	/**
	 * TODO 简单描述该方法的实现功能（可选）.
	 * 
	 * @see com.efast.emfg.remote.les.TwBasDpathWindowTimeService#queryWindowTime()
	 */
	@Override
	public List<DpathWindowTimeBean> queryWindowTime() {
		return twBasDpathWindowTimeDao.queryWindowTime();
	}

	/**
	 * 查询补货路径是否今天已经生成了窗口时间
	 *
	 * @return List<DpathWindowTimeBean>
	 */
	@Override
	public TwBasDpathWindowTime queryTwBasDpathWindowTime() {
		return twBasDpathWindowTimeDao.queryTwBasDpathWindowTime();
	}

	/**
	 * 查询所有的补货路径
	 *
	 * @return List<DpathWindowTimeBean>
	 */
	@Override
	public List<Integer> queryReplenishmentPath() {
		return twBasDpathWindowTimeDao.queryReplenishmentPath();
	}

	/**
	 * TODO 简单描述该方法的实现功能（可选）.
	 * 
	 * @see com.efast.emfg.remote.les.TwBasDpathWindowTimeService#insertNonEmptyTwBasDpathWindowTime(com.efast.emfg.po.les.TwBasDpathWindowTime)
	 */
	@Override
	public int insertNonEmptyTwBasDpathWindowTime(TwBasDpathWindowTime value) {
		return twBasDpathWindowTimeDao.insertNonEmptyTwBasDpathWindowTime(value);
	}

	/**
	 * 按照路径分组找出符合条件的补货路径，查看是否有补货需求。
	 * 
	 * @see com.efast.emfg.remote.les.TwBasDpathWindowTimeService#queryWindowReplenishment()
	 */
	@Override
	public List<WindowReplenishmentBean> queryWindowReplenishment() {
		return twBasDpathWindowTimeDao.queryWindowReplenishment();
	}

	/**
	 * 找出该补货路径下面所有的库位的零件消耗情况
	 * 
	 * @see com.efast.emfg.remote.les.TwBasDpathWindowTimeService#queryInventoryQuantityByDpathId(int)
	 */
	@Override
	public List<InventoryQuantityBean> queryInventoryQuantityByDpathId(int pathId) {
		return twBasDpathWindowTimeDao.queryInventoryQuantityByDpathId(pathId);
	}

	/**
	 * 查询该库位零件，前面未完成的补货数量
	 * 
	 * @see com.efast.emfg.remote.les.TwBasDpathWindowTimeService#queryNotQuantityOfReplenishment(int, java.lang.String,
	 *      java.lang.String)
	 */
	@Override
	public TwInvPalMriJobBean queryNotQuantityOfReplenishment(int locId, String supplNo, String partNoVersion) {
		return twBasDpathWindowTimeDao.queryNotQuantityOfReplenishment(locId, supplNo, partNoVersion);
	}

	/**
	 * 查询 前面未完成的 实际补货数量 如果是null,则表面没有补货过
	 *
	 * @param locId
	 *            库位id
	 * @param supplNo
	 *            供应商
	 * @param partNoVersion
	 *            零件号
	 * @return Integer
	 */
	@Override
	public Integer queryActRepQty(int locId, String supplNo, String partNoVersion) {
		return twBasDpathWindowTimeDao.queryActRepQty(locId, supplNo, partNoVersion);
	}

}
